Left Termination of the query pattern factor_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

factor(.(X, []), X).
factor(.(X, .(Y, Xs)), T) :- ','(times(X, Y, Z), factor(.(Z, Xs), T)).
times(0, X_, 0).
times(s(X), Y, Z) :- ','(times(X, Y, XY), plus(XY, Y, Z)).
plus(0, X, X).
plus(s(X), Y, s(Z)) :- plus(X, Y, Z).

Queries:

factor(g,a).

We use the technique of [30]. With regard to the inferred argument filtering the predicates were used in the following modes:
factor_in: (b,f)
times_in: (b,b,f)
plus_in: (b,b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

FACTOR_IN_GA(.(X, .(Y, Xs)), T) → U1_GA(X, Y, Xs, T, times_in_gga(X, Y, Z))
FACTOR_IN_GA(.(X, .(Y, Xs)), T) → TIMES_IN_GGA(X, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U3_GGA(X, Y, Z, times_in_gga(X, Y, XY))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, XY)
U3_GGA(X, Y, Z, times_out_gga(X, Y, XY)) → U4_GGA(X, Y, Z, plus_in_gga(XY, Y, Z))
U3_GGA(X, Y, Z, times_out_gga(X, Y, XY)) → PLUS_IN_GGA(XY, Y, Z)
PLUS_IN_GGA(s(X), Y, s(Z)) → U5_GGA(X, Y, Z, plus_in_gga(X, Y, Z))
PLUS_IN_GGA(s(X), Y, s(Z)) → PLUS_IN_GGA(X, Y, Z)
U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_GA(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → FACTOR_IN_GA(.(Z, Xs), T)

The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)
U2_GA(x1, x2, x3, x4, x5)  =  U2_GA(x5)
FACTOR_IN_GA(x1, x2)  =  FACTOR_IN_GA(x1)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)
TIMES_IN_GGA(x1, x2, x3)  =  TIMES_IN_GGA(x1, x2)
PLUS_IN_GGA(x1, x2, x3)  =  PLUS_IN_GGA(x1, x2)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x3, x5)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x2, x4)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

FACTOR_IN_GA(.(X, .(Y, Xs)), T) → U1_GA(X, Y, Xs, T, times_in_gga(X, Y, Z))
FACTOR_IN_GA(.(X, .(Y, Xs)), T) → TIMES_IN_GGA(X, Y, Z)
TIMES_IN_GGA(s(X), Y, Z) → U3_GGA(X, Y, Z, times_in_gga(X, Y, XY))
TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, XY)
U3_GGA(X, Y, Z, times_out_gga(X, Y, XY)) → U4_GGA(X, Y, Z, plus_in_gga(XY, Y, Z))
U3_GGA(X, Y, Z, times_out_gga(X, Y, XY)) → PLUS_IN_GGA(XY, Y, Z)
PLUS_IN_GGA(s(X), Y, s(Z)) → U5_GGA(X, Y, Z, plus_in_gga(X, Y, Z))
PLUS_IN_GGA(s(X), Y, s(Z)) → PLUS_IN_GGA(X, Y, Z)
U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_GA(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → FACTOR_IN_GA(.(Z, Xs), T)

The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)
U2_GA(x1, x2, x3, x4, x5)  =  U2_GA(x5)
FACTOR_IN_GA(x1, x2)  =  FACTOR_IN_GA(x1)
U4_GGA(x1, x2, x3, x4)  =  U4_GGA(x4)
TIMES_IN_GGA(x1, x2, x3)  =  TIMES_IN_GGA(x1, x2)
PLUS_IN_GGA(x1, x2, x3)  =  PLUS_IN_GGA(x1, x2)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x3, x5)
U5_GGA(x1, x2, x3, x4)  =  U5_GGA(x4)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x2, x4)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 3 SCCs with 6 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PLUS_IN_GGA(s(X), Y, s(Z)) → PLUS_IN_GGA(X, Y, Z)

The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)
PLUS_IN_GGA(x1, x2, x3)  =  PLUS_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

PLUS_IN_GGA(s(X), Y, s(Z)) → PLUS_IN_GGA(X, Y, Z)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
PLUS_IN_GGA(x1, x2, x3)  =  PLUS_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

PLUS_IN_GGA(s(X), Y) → PLUS_IN_GGA(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, XY)

The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)
TIMES_IN_GGA(x1, x2, x3)  =  TIMES_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

TIMES_IN_GGA(s(X), Y, Z) → TIMES_IN_GGA(X, Y, XY)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
TIMES_IN_GGA(x1, x2, x3)  =  TIMES_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

TIMES_IN_GGA(s(X), Y) → TIMES_IN_GGA(X, Y)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
PiDP
                ↳ UsableRulesProof

Pi DP problem:
The TRS P consists of the following rules:

U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → FACTOR_IN_GA(.(Z, Xs), T)
FACTOR_IN_GA(.(X, .(Y, Xs)), T) → U1_GA(X, Y, Xs, T, times_in_gga(X, Y, Z))

The TRS R consists of the following rules:

factor_in_ga(.(X, []), X) → factor_out_ga(.(X, []), X)
factor_in_ga(.(X, .(Y, Xs)), T) → U1_ga(X, Y, Xs, T, times_in_gga(X, Y, Z))
times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
U1_ga(X, Y, Xs, T, times_out_gga(X, Y, Z)) → U2_ga(X, Y, Xs, T, factor_in_ga(.(Z, Xs), T))
U2_ga(X, Y, Xs, T, factor_out_ga(.(Z, Xs), T)) → factor_out_ga(.(X, .(Y, Xs)), T)

The argument filtering Pi contains the following mapping:
factor_in_ga(x1, x2)  =  factor_in_ga(x1)
.(x1, x2)  =  .(x1, x2)
[]  =  []
factor_out_ga(x1, x2)  =  factor_out_ga(x2)
U1_ga(x1, x2, x3, x4, x5)  =  U1_ga(x3, x5)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
U2_ga(x1, x2, x3, x4, x5)  =  U2_ga(x5)
FACTOR_IN_GA(x1, x2)  =  FACTOR_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x3, x5)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

U1_GA(X, Y, Xs, T, times_out_gga(X, Y, Z)) → FACTOR_IN_GA(.(Z, Xs), T)
FACTOR_IN_GA(.(X, .(Y, Xs)), T) → U1_GA(X, Y, Xs, T, times_in_gga(X, Y, Z))

The TRS R consists of the following rules:

times_in_gga(0, X_, 0) → times_out_gga(0, X_, 0)
times_in_gga(s(X), Y, Z) → U3_gga(X, Y, Z, times_in_gga(X, Y, XY))
U3_gga(X, Y, Z, times_out_gga(X, Y, XY)) → U4_gga(X, Y, Z, plus_in_gga(XY, Y, Z))
U4_gga(X, Y, Z, plus_out_gga(XY, Y, Z)) → times_out_gga(s(X), Y, Z)
plus_in_gga(0, X, X) → plus_out_gga(0, X, X)
plus_in_gga(s(X), Y, s(Z)) → U5_gga(X, Y, Z, plus_in_gga(X, Y, Z))
U5_gga(X, Y, Z, plus_out_gga(X, Y, Z)) → plus_out_gga(s(X), Y, s(Z))

The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
times_in_gga(x1, x2, x3)  =  times_in_gga(x1, x2)
0  =  0
times_out_gga(x1, x2, x3)  =  times_out_gga(x3)
s(x1)  =  s(x1)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x2, x4)
U4_gga(x1, x2, x3, x4)  =  U4_gga(x4)
plus_in_gga(x1, x2, x3)  =  plus_in_gga(x1, x2)
plus_out_gga(x1, x2, x3)  =  plus_out_gga(x3)
U5_gga(x1, x2, x3, x4)  =  U5_gga(x4)
FACTOR_IN_GA(x1, x2)  =  FACTOR_IN_GA(x1)
U1_GA(x1, x2, x3, x4, x5)  =  U1_GA(x3, x5)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

FACTOR_IN_GA(.(X, .(Y, Xs))) → U1_GA(Xs, times_in_gga(X, Y))
U1_GA(Xs, times_out_gga(Z)) → FACTOR_IN_GA(.(Z, Xs))

The TRS R consists of the following rules:

times_in_gga(0, X_) → times_out_gga(0)
times_in_gga(s(X), Y) → U3_gga(Y, times_in_gga(X, Y))
U3_gga(Y, times_out_gga(XY)) → U4_gga(plus_in_gga(XY, Y))
U4_gga(plus_out_gga(Z)) → times_out_gga(Z)
plus_in_gga(0, X) → plus_out_gga(X)
plus_in_gga(s(X), Y) → U5_gga(plus_in_gga(X, Y))
U5_gga(plus_out_gga(Z)) → plus_out_gga(s(Z))

The set Q consists of the following terms:

times_in_gga(x0, x1)
U3_gga(x0, x1)
U4_gga(x0)
plus_in_gga(x0, x1)
U5_gga(x0)

We have to consider all (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


FACTOR_IN_GA(.(X, .(Y, Xs))) → U1_GA(Xs, times_in_gga(X, Y))
The remaining pairs can at least be oriented weakly.

U1_GA(Xs, times_out_gga(Z)) → FACTOR_IN_GA(.(Z, Xs))
Used ordering: Polynomial interpretation [25]:

POL(.(x1, x2)) = 1 + x2   
POL(0) = 1   
POL(FACTOR_IN_GA(x1)) = x1   
POL(U1_GA(x1, x2)) = 1 + x1   
POL(U3_gga(x1, x2)) = 0   
POL(U4_gga(x1)) = 0   
POL(U5_gga(x1)) = 1   
POL(plus_in_gga(x1, x2)) = 1 + x1 + x2   
POL(plus_out_gga(x1)) = 0   
POL(s(x1)) = 1 + x1   
POL(times_in_gga(x1, x2)) = 0   
POL(times_out_gga(x1)) = 0   

The following usable rules [17] were oriented: none



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

U1_GA(Xs, times_out_gga(Z)) → FACTOR_IN_GA(.(Z, Xs))

The TRS R consists of the following rules:

times_in_gga(0, X_) → times_out_gga(0)
times_in_gga(s(X), Y) → U3_gga(Y, times_in_gga(X, Y))
U3_gga(Y, times_out_gga(XY)) → U4_gga(plus_in_gga(XY, Y))
U4_gga(plus_out_gga(Z)) → times_out_gga(Z)
plus_in_gga(0, X) → plus_out_gga(X)
plus_in_gga(s(X), Y) → U5_gga(plus_in_gga(X, Y))
U5_gga(plus_out_gga(Z)) → plus_out_gga(s(Z))

The set Q consists of the following terms:

times_in_gga(x0, x1)
U3_gga(x0, x1)
U4_gga(x0)
plus_in_gga(x0, x1)
U5_gga(x0)

We have to consider all (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 1 less node.